﻿using EmbeddedSharp.Core;

namespace Zove.Runtime.Core.Expression {

    /// <summary>
    /// Factor node
    /// </summary>
    public class FactorNode : IdentifierNode {
        /// <summary>
        /// Default constructor
        /// </summary>
        public FactorNode() {
        }

        /// <summary>
        /// Default constructor with a runtime factor
        /// </summary>
        /// <param name="rf">the runtime factor</param>
        public FactorNode(RuntimeFactor rf) {
            base.Value = rf.Name;
            Factor = rf;
        }

        /// <summary>
        /// Runtime factor
        /// </summary>
        public RuntimeFactor Factor { get; set; }

        /// <summary>
        /// Evaluate the factor
        /// </summary>
        /// <returns></returns>
        public override object Evaluate() {
            return Factor.Value.ToString();
        }
    }
}